#ifndef _LICENSEIMPL_H_
#define _LICENSEIMPL_H_

#include "stdafx.h"

class CLicenseImpl : public ILicense, public IPlugin
{
public:
    CLicenseImpl(void);
    virtual ~CLicenseImpl(void);

    BEGIN_STDCOM_MAP_EX
    STDCOM_INTERFACE_ENTRY_UNKNOWN_(ILicense)
    STDCOM_INTERFACE_ENTRY(IPlugin)
    STDCOM_INTERFACE_ENTRY(ILicense)
    END_STDCOM_MAP_EX

    std_method_(ULONG, AddRef)()
    {
        m_ref++;
        return m_ref;
    }

    std_method_(ULONG, Release)()
    {
        m_ref--;
        if (m_ref == 0) {
            delete this;
        }
        return 0;
    }

public:
    // IPlugin
    std_method(Init)(IBase* pRot, IBase* pBase);
    std_method(Uninit)();

    // ILicense
    std_method(OnStartApp)(int index);
    std_method(OnStopApp)(int index);
    std_method_(int, GetAppCount)();
    std_method_(int, GetAppVersion)(int index);

private:
    long m_ref;
};

#endif
